#include "Chhol.h"
namespace Chhol{
	void ChholCmd::send(sPkg* pkg_to_send){
		pkg_to_send->len+=4;
		CC9D::send((sCc9dPkg*)pkg_to_send);
	}
	sCc9dPkg* ChholCmd::receiced(sCc9dPkg* pkg_received){
		pkg_received->len-=4;
		if(receivedCB!=0){
			return (sCc9dPkg*)receivedCB((sPkg*)pkg_received);
		}else{
			return 0;
		}
	}
	void ChholCmd::init(Stream* stream, dChholPkg receivedCB,sPkg* receive_space){
		CC9D::init((sCc9dPkg *)receive_space,127);
		CC9D::stream = stream;
		this->receivedCB = receivedCB;
	}
}